headerbar: Null-check boxes when removing window controls
authorAlexander Mikhaylenko <alexm@gnome.org>
Mon, 8 Feb 2021 13:46:35 +0000 (18:46 +0500)
committerAlexander Mikhaylenko <alexm@gnome.org>
Mon, 8 Feb 2021 13:46:35 +0000 (18:46 +0500)
Prevent a crash when show-title-buttons value changes to FALSE during
destruction.

gtk/gtkheaderbar.c

index 6f90f38f6b5e1d61ef6e5064b5495944269e82f2..786dfb754e7211ffaa40de4b0f805df2304ba96d 100644 (file)
@@ -743,13 +743,13 @@ gtk_header_bar_set_show_title_buttons (GtkHeaderBar *bar,
     create_window_controls (bar);
   else
     {
-      if (bar->start_window_controls)
+      if (bar->start_box && bar->start_window_controls)
         {
           gtk_box_remove (GTK_BOX (bar->start_box), bar->start_window_controls);
           bar->start_window_controls = NULL;
         }
 
-      if (ar->end_window_controls)
+      if (bar->end_box && bar->end_window_controls)
         {
           gtk_box_remove (GTK_BOX (bar->end_box), bar->end_window_controls);
           bar->end_window_controls = NULL;